import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class SymbTable {

	// store symbols and its values
	private static Map<String, Integer> symTab = new HashMap<String, Integer>();

	// store names of constants.
	private static List<String> Constants = new ArrayList<String>();

	//
	public static int stSym(String sym, Integer val) {
		// Check for uniqueness.If already exists, return 0.
		if (symTab.containsKey(sym)) {
			return 0;
		}
		symTab.put(sym, val);
		// return 1 means operation succeed.
		return 1;
	}

	public static Integer getVal(String sym) {

		return symTab.get(sym);
	}

	public static void addToConsLst(String str) {
		Constants.add(str);
	}

	public static boolean isConst(String str) {
		//check if a symbol is defined by .EQU or not.
		return Constants.contains(str);
	}

	public static boolean hasSym(String val) {
		return symTab.containsKey(val);
	}

}
